{{- range $key, $value := .CandiVersionMap.k8s }}
  {{- $version := toString $key }}
  {{- $patch := $value.patch | toString }}
  {{- $image_version := printf "%s.%s" $version $patch | replace "." "-" }}
---
image: {{ $.ModuleName }}/{{ $.ImageName }}-{{ $version | replace "." "-" }}
fromImage: common/distroless
fromCacheVersion: 1
import:
- artifact: common/kubernetes-artifact-{{ $image_version }}
  add: /src/_output/bin
  to: /
  includePaths:
  - kubeadm
  before: install
- artifact: {{ $.ModuleName }}/controller-artifact
  add: /controller
  to: /controller
  before: install
docker:
  ENTRYPOINT: ["/controller"]
{{- end }}
---
artifact: {{ $.ModuleName }}/controller-artifact
from: {{ $.Images.BASE_GOLANG_21_ALPINE }}
fromCacheVersion: 1
git:
  - add: /{{ $.ModulePath }}modules/040-{{ $.ModuleName }}/images/{{ $.ImageName }}/controller
    to: /
    stageDependencies:
      install:
        - '**/*'
mount:
  - fromPath: ~/go-pkg-cache
    to: /go/pkg
shell:
  install:
    - GOPROXY={{ $.GOPROXY }} GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -ldflags="-s -w" -o controller controller.go node.go util.go pki.go kubeconfig.go converge.go config.go handlers.go
